package com.sms.plateform.kernel.service.impl;

import java.util.List;
import java.util.Map;

import com.sms.plateform.common.page.PageList;
import com.sms.plateform.common.page.PageProperty;
import com.sms.plateform.common.util.PageUtil;
import com.sms.plateform.kernel.service.impl.BaseServiceImpl;
import com.sms.plateform.kernel.dao.IBusinesscardDao;
import com.sms.plateform.kernel.entity.Businesscard;
import com.sms.plateform.kernel.service.IBusinesscardService;

/**
 * @Description:实现类
 * @author 
 * @version 1.0
 * @created 
 */
public class BusinesscardServiceImpl extends BaseServiceImpl<Businesscard,IBusinesscardDao> implements IBusinesscardService {

	public String insertNewCard(Map<String, Object> param) {
		this.getBaseDao().insertNewCard(param);
		return "success";
	}

	public PageList<Map<String, Object>> getBusinessCardList(PageProperty pp) {
		int count =this.getBaseDao().getBusinessCardListCount(pp);
		int start = PageUtil.getStart(pp.getNpage(), count, pp.getNpagesize());
		int end = PageUtil.getEnd(pp.getNpage(), count, pp.getNpagesize());
		pp.putParamMap("startrow", start);
		pp.putParamMap("endrow", end);
		PageList<Map<String, Object>> pageList = new PageList<Map<String, Object>>(pp, count, this.getBaseDao().getCatForRelPageList(pp));
		return pageList;
	}

	public String deleteBusinessCardByIds(Map<String, Object> param) {
		this.getBaseDao().deleteBusinessCardByIds(param);
		return "success";
	}

	public String addBusinessCardGroup(Map<String, Object> param) {
		this.getBaseDao().addBusinessCardGroup(param);
		return null;
	}

	public String deleteBusinesscardGroupById(Map<String, Object> param) {
		this.getBaseDao().deleteBusinesscardGroupById(param);
		this.getBaseDao().deleteBusinesscardByGroupId(param);
		return "success";
	}

	public Map<String, Object> getBusinessCardInfo(Map<String, Object> param) {
		return this.getBaseDao().getBusinessCardInfo(param);
	}

	public String updateBusinessCard(Map<String, Object> param) {
		this.getBaseDao().updateBusinessCard(param);
		return "success";
	}

}
